/*
 * @Author: 九阳
 * @Date: 2021-11-20 10:24:33
 * @LastEditors: 九阳
 * @LastEditTime: 2022-08-03 14:21:23
 */
import { App } from "vue";

import permission from "@/directives/permission";
import copy from "@/directives/copy";
import debounce from "@/directives/debounce";
import draggable from "@/directives/draggable";
import emoji from "@/directives/emoji";
// import lazyLoad from "@/directives/lazyLoad";
import longPress from "@/directives/longpress";
import waterMarker from "@/directives/waterMarker";
import loadingDirective from "@/directives/loading";
//  vue2  -> vue3
// created - 新的！在元素的 attribute 或事件侦听器应用之前调用。
// bind → beforeMount
// inserted → mounted
// beforeUpdate：新的！这是在元素本身更新之前调用的，很像组件生命周期钩子。
// update → 移除！有太多的相似之处要更新，所以这是多余的，请改用 updated。
// componentUpdated → updated
// beforeUnmount：新的！与组件生命周期钩子类似，它将在卸载元素之前调用。
// unbind -> unmounted
// Vue3自定义指令钩子 生命周期
// const MyDirective = {
//   beforeMount(el, binding, vnode, prevVnode) {},
//   mounted() {},
//   beforeUpdate() {}, // 新
//   updated() {},
//   beforeUnmount() {}, // 新
//   unmounted() {}
// }
/**
 * 注册全局自定义指令
 * @param app
 */
export function setupDirectives(app: App) {
  // 权限控制指令（演示）
  app.use(permission);
  app.use(copy);
  app.use(debounce);
  app.use(draggable);
  app.use(emoji);
  // app.use(lazyLoad);
  app.use(longPress);
  app.use(waterMarker);
  app.use(loadingDirective);
}
